<?php


namespace support\exception;


use Throwable;
use Webman\Exception\ExceptionHandler;
use Webman\Http\Request;
use Webman\Http\Response;

class ApiHandler extends ExceptionHandler
{
    public $dontReport = [
        BadException::class,
    ];

    public function report(Throwable $exception)
    {
        parent::report($exception);
    }

    public function render(Request $request, Throwable $exception): Response
    {
        if(($exception instanceof BadException) && ($response = $exception->render($request)))
        {
            return $response;
        }
        return parent::render($request, $exception);
    }

}